import { createRouter, createWebHistory } from 'vue-router'
import Edit from '../components/Edit.vue'
import Quill from '../components/Quill.vue'
import Test from '../components/Test.vue'
import Demo from "../components/Demo.vue";
import Preview from "@/components/Preview.vue";

const routes = [
    {
        path: '/edit',
        name: 'edit',
        component: Edit
    },
    {
        path: '/quill',
        name: 'quill',
        component: Quill
    },
	{
	    path: '/test',
	    name: 'test',
	    component: Test
	},
    {
        path: '/CVC',
        name: 'cvc',
        children: [
            {
                path: '',
                name: 'main',
                redirect: '/CVC/homepage'  // 路径保持小写
            },
            {
                path: 'homepage',  // 路径小写
                name: 'homepage',
                component: () => import('@/components/CVC/Homepage.vue')
            },
            {
                path: 'question-test',  // 使用连字符或驼峰命名
                name: 'questionTest',
                component: () => import('@/components/CVC/QuestionTest.vue')
            },
            {
                path:'question-edit',
                name:'questionEdit',
                component:()=>import('@/components/CVC/QuestionEdit.vue')
            }
        ]
    },
    {
        path: '/',
        name: 'rootHomepage',  // 与其他首页区分
        component: () => import('@/components/Homepage.vue')
    },
    {
        path: '/:pathMatch(.*)*',  // 通配符 404 页面
        name: 'notFound',
        component: () => import('@/components/NotFound.vue')
    },
    {
        path: '/demo',
        name: 'demo',
        component: Demo
    },
    {
        path: '/preview',
        name: 'preview',
        component: Preview
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router
